package vip.youngboy.freejump.constant;

import org.activiti.engine.ActivitiException;

public enum TaskActionType {

    AGREE("agree", "同意"),
    START("start", "发起流程"),
    TODO("todo", "待审批"),
    REJECT("reject", "驳回"),
    REJECT2("reject2", "驳回"),
    LOCK("lock", "认领任务"),
    UNLOCK("unlock", "归还任务"),
    REPORT("report", "上报"),
    TRANSFER("transfer", "转让");

    private String key;

    private String name;

    private TaskActionType(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public static TaskActionType fromKey(String key) {
        for (TaskActionType value : values()) {
            if (value.key.equalsIgnoreCase(key)) {
                return value;
            }
        }
        throw new ActivitiException("无对应action操作");
    }

}
